import { MockMethod } from 'vite-plugin-mock'
import { config } from '@/config/axios/config'
const { result_code } = config
// 初始学期
let start = 2018
// 获取学期
interface List {
  semester_id: number
  semester_name: string
}
const data = [] as Array<List>

const date = new Date()
const year = date.getFullYear()
//const month = date.getMonth() + 1
// const day = date.getDate()

for (; start < year; start++) {
  let semester_id = start.toString() + (start + 1) + '1'
  data.unshift({
    semester_id: parseInt(semester_id),
    semester_name: start + '-' + (start + 1) + '第一学期'
  })
  semester_id = start.toString() + (start + 1) + '2'
  data.unshift({
    semester_id: parseInt(semester_id),
    semester_name: start + '-' + (start + 1) + '第二学期'
  })
}
export default [
  {
    url: '/semester',
    method: 'get',
    response: () => {
      return {
        code: result_code,
        data
      }
    }
  }
] as MockMethod[]
